package com.neusoft.dibuy.m3elm;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * File API  ，
 */
//@WebServlet(name = "helloServlet", value = "/hello-servlet")
public class HelloServlet extends HttpServlet {
    public HelloServlet( ) {
        System.out.println("HelloServlet.HelloServlet");
    }

    @Override
    public void init(ServletConfig config) throws ServletException {

    }

    private    int index = 0 ;
    int times = 0 ;
    private String message;
    public void init() {
        message = "Hello World!";
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/html");
        int i = 1000;
        i++;
        System.out.println( "i ---- >  " +  i );
        // Hello
        PrintWriter out = response.getWriter();
        index++;
        System.out.println("get  ----   > " +   index);
        out.println("<html><body>");
        out.println("<h1>" + message + "</h1>");
        out.println("</body></html>");
    }

    public void destroy() {
    }
}